package io.renren.modules.live.controller;

import java.util.Arrays;
import java.util.Map;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.live.entity.FanweRechargeRuleEntity;
import io.renren.modules.live.service.FanweRechargeRuleService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 充值规则
 *
 * @author shaoqi
 * @email sunlightcs@gmail.com
 * @date 2020-11-17 09:18:22
 */
@Api(tags = "充值规则管理")
@RestController
@RequestMapping("live/fanwerechargerule")
public class FanweRechargeRuleController {
    @Autowired
    private FanweRechargeRuleService fanweRechargeRuleService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("live:fanwerechargerule:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = fanweRechargeRuleService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info")
    //@RequiresPermissions("live:fanwerechargerule:info")
    public R info(@ApiParam(value = "用户ID",required = true) Integer id){
		FanweRechargeRuleEntity fanweRechargeRule = fanweRechargeRuleService.getById(id);

        return R.ok().put("fanweRechargeRule", fanweRechargeRule);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("live:fanwerechargerule:save")
    public R save(@RequestBody FanweRechargeRuleEntity fanweRechargeRule){
		fanweRechargeRuleService.save(fanweRechargeRule);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("live:fanwerechargerule:update")
    public R update(@RequestBody FanweRechargeRuleEntity fanweRechargeRule){
		fanweRechargeRuleService.updateById(fanweRechargeRule);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("live:fanwerechargerule:delete")
    public R delete(@RequestBody Integer[] ids){
		fanweRechargeRuleService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
